uniform float time;
varying float zPos;

float pointSize(vec4 loc)
{
float ptSize = length(loc);
return (10000.0/ptSize);
}


//changed so that sprites can also use this shader
void main()
{
//reset gl_Vertex coordinate or we create weird distortions!
vec4 myVertex=gl_Vertex;
myVertex.w=1.0;
float particleScale=gl_Vertex.w * 1.0;

vec4 intermediate = gl_ModelViewMatrix * myVertex;
gl_Position = gl_ProjectionMatrix * intermediate;
gl_PointSize= pointSize(gl_Position)*particleScale;
gl_FrontColor=gl_Color;
zPos=gl_Position.z;
}




